﻿namespace ErrorDumper {
    public static class ExceptionDataSource {

        private static readonly object _syncRoot = new object();
        private static IExceptionDataSource _current;

        public static IExceptionDataSource Current {
            get {
                lock (_syncRoot)
                    return _current ?? (_current = new DefaultExceptionDataSource());
            }
            set {
                lock (_syncRoot)
                    _current = value;
            }
        }

        public static void Reset() {
            Current = null;
        }

        public static bool IsDefault {
            get { return Current.GetType() == typeof(DefaultExceptionDataSource); }
        }
    }
}